import { createRouter, createWebHashHistory } from 'vue-router'
import signupRouter from '../modules/signup'
 
const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/index'
    },
    {
      path: '/index',
      name: '首页',
      meta: {
        title: '大赛平台'
      },
      component: () => import('@/views/C.vue')
    },
    signupRouter,
  ]
})
 
/**
 * @description 路由拦截 beforeEach
 * */
router.beforeEach(async (to, from, next) => {
  // 动态设置标题
  const title = import.meta.env.VITE_GLOB_APP_TITLE
  document.title = to.meta.title ? (to.meta.title as string) : title
  next()
})
 
export default router